<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		
		<form name="form1" id="form1">
			用户名：
			
			
		</form>
		<form name="form2">
			选择年份 <select id="sel1"></select>
		</form>
		
		<button onclick="add()">添加</button>
		
		<script>
			
			function add(){
				
				console.log("add()")
				
				// 创建网页元素
				var txt = document.createElement("input");
				// 设置属性
				txt.type = "text";
				txt.name = "username";
				// 放到页面的某个元素
				form1.appendChild(txt);
			}
			

			for(var i = 2000; i <= 2024; i++){
				var op1 = document.createElement("option");
				var op1txt = document.createTextNode(i);
				op1.appendChild(op1txt);
				sel1.appendChild(op1);
			}

			
			
			
		</script>
		
	</body>
</html>